import java.util.Arrays;

public class targetAnd {
    public static int[] myTargetAnd(int[] array,int target){
        for(int i = 0;i < array.length;i ++){
            for(int j = 0;j < array.length;j ++){
                if(i != j && array[i] + array[j] == target){
                    int[] arr = new int[2];
                    arr[0] = array[i];
                    arr[1] = array[j];
                    return arr;
                }
            }
        }
        return null;
    }
    public static void main(String[] args) {
        int[] array = new int[]{1,2,3,4,5};
        int [] arr = myTargetAnd(array,8);
        System.out.println(Arrays.toString(arr));;
    }
}
